<!DOCTYPE html>
<html>
 	<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>学生课堂绑定</title>
  <meta name="description" content="这是一个 index 页面">
  <meta name="keywords" content="index">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="icon" type="image/png" href="assets/i/favicon.png">
  <link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">
  <meta name="apple-mobile-web-app-title" content="Amaze UI" />
  <link rel="stylesheet" href="assets/css/amazeui.min.css" />
  <link rel="stylesheet" href="assets/css/admin.css">
  <link rel="stylesheet" href="assets/css/app.css">
  <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
  <script type="text/javascript" src="assets/js/jquery.min.js" ></script>
  <style>
  	.check_stnum{
  		color:#C00; 
		font-weight:bold; 
  	}
  </style>
</head>

<body data-type="login">

  <div class="am-g myapp-login">
	<div class="myapp-login-logo-block  tpl-login-max">
		<div class="myapp-login-logo-text">
			<div class="myapp-login-logo-text">
				学生课堂<span> 绑定</span> <i class="am-icon-skyatlas"></i>
				
			</div>
		</div>

		<div class="login-font">
			<i>Student </i> Class <span>binding</span>
		</div>
		<div class="am-u-sm-10 login-am-center">
			<form class="am-form" action="/bindController" onsubmit="return check()">
				<fieldset>
						<div class="am-form-group">
						<input type="text" class="" id="doc-ipt-stnum-1" name="student_num" placeholder="输入学号">
						<label id="numCheck" class="check_stnum" hidden="true">学号错误！</label>
					</div>
						<label></label>
				
						<div class="am-form-group">
							<select id = "doc-ipt-lesson-1" name="lesson_id" class="am-form-group">
							<option value="">请选择绑定的课堂</option>
							
				<!--
               		 <%
   ArrayList userlist=(ArrayList)request.getAttribute("userlist");
     		int i;
        for(i=0;i<userlist.size();i++)  
                {  
                    User user=(User)userlist.get(i);
   %>  
        <option value="<%=user.getXxx()%>"><%=user.getXxx() %></option>
              <%} %> -->	
        <script>
            
          $.ajax({
			type:"post",
			url:"/bind",
			data:"",
			success:function(data) {
			//	var  list=  eval("("+data+")");
				$.each(data,function(i,item){
				$("<option value="+item.lesson_id+">"+item.name+item.class_grade+"</option>").appendTo("#doc-ipt-lesson-1");
			}
			); 
				}
			}); 
             	     	
        </script>
        
              
						</select>
						
						</div>
						
						<label></label>
					<div class="am-form-group">
						<input type="text" class="" id="doc-ipt-wopenid-1" name="wechat_num" placeholder="输入微信号">
						</div>
						<label></label>
					<p><button type="submit" class="am-btn am-btn-default">确认</button></p>
						
				</fieldset>
			</form>
		</div>
	</div>
</div>
<script type="text/javascript">
	function check(str) 
	{  
		var val2 = document.getElementById("numCheck").value;
		var val = document.getElementById("doc-ipt-stnum-1").value;
	               // alert(val);
					
                 if(val.length == 10){
                     //alert("校验成功，之后进行提交");
					   val2.hidden = false;
                     return true;
                 }
                 else{
                 	 //val2.hidden = true;
                     alert("学号错误！");
                     return false;
                 }
	}
</script>
  <script src="assets/js/jquery.min.js"></script>
  <script src="assets/js/amazeui.min.js"></script>
  <script src="assets/js/app.js"></script>
</body>
</html>
